{% extends "admin/base_site.html" %}
{% load filer_admin_tags i18n staticfiles %}
{% load url from suit_compat %}

{% block extrahead %}{{ block.super }}
{# upload stuff #}
{{ media.js }}
<script type="text/javascript" src="{% static 'admin/js/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'filer/js/jquery.cookie.js' %}"></script>
<script type="text/javascript" src="{% static 'filer/js/fileuploader.js' %}"></script>
<script type="text/javascript" src="{% static 'filer/js/retina.js' %}"></script>
<script type="text/javascript" src="{% static 'admin/js/admin/RelatedObjectLookups.js' %}"></script>
<script type="text/javascript" src="{% static 'filer/js/popup_handling.js' %}"></script>
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
<script type="text/javascript">
(function($) {
    $(document).ready(function($) {
        $("tr input.action-select").actions();
    });
})(django.jQuery);
</script>
{% endif %}{% endif %}
{% endblock %}

{% block coltype %}flex{% endblock %}
{% block bodyclass %}change-list filebrowser{% endblock %}


{% block extrastyle %}{{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static 'filer/css/admin_style.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'suit/css/filer.css' %}">
{{ media.css }}
{% if action_form %}
  {% url 'admin:jsi18n' as jsi18nurl %}
  <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
{% endif %}
{% if query.pop %}
<style type="text/css">
    #header { display: none; }
</style>
{% endif %}
{% if not actions_on_top and not actions_on_bottom %}
<style>
    #changelist table thead th:first-child {width: inherit}
</style>
{% endif %}
{% endblock %}

{% block breadcrumbs %}
{% with folder as instance %}
{% include "admin/filer/breadcrumbs.html" %}
{% endwith %}
{% endblock %}


{% block content_title %}<h2 class="content-title">&nbsp;</h2>{% endblock %}
{% block content %}
<div id="content-main" class="inner-two-columns clearfix">

    <div class="inner-right-column content-related">
        {% include "admin/filer/tools/clipboard/clipboard.html" %}
    </div>

    <div class="inner-center-column">
        <div class="module" id="changelist">

            <div class="toolbar-content">
                {% block search %}
                <div class="object-tools">
                    {% if folder.can_have_subfolders %}<a id="id_new_folder" href="{% url 'admin:filer-directory_listing-make_root_folder' %}?parent_id={{ folder.id }}" class="btn btn-success addlink" onclick="return showAddAnotherPopup(this);" title="{% trans "Adds a new Folder" %}"><i class="icon-plus-sign icon-white"></i>&nbsp; {% trans "New Folder" %}</a>{% endif %}
                    <a id="id_upload_button" href="#" class="addlink btn btn-info" title="{% trans 'upload files' %}"><i class="icon-upload icon-white"></i>&nbsp; {% trans 'Upload' %}</a>
                    {% include 'admin/filer/tools/upload_button_js.html' %}
                </div>
                {% include "admin/filer/tools/search_form.html" %}
                {% endblock %}
            </div>

            {% if not folder.is_root %}
            <h2 class="folder_header">{% if folder.parent %}<a href="{% url 'admin:filer-directory_listing' folder.parent.id %}{% if is_popup %}?_popup=1{% if select_folder %}&select_folder=1{% endif %}{% endif %}" title="{% trans "Go back to the parent folder" %}"><i class="icon-arrow-up icon-alpha75"></i></a>{% else %}<a href="{% url 'admin:filer-directory_listing-root' %}{% if is_popup %}?_popup=1{% if select_folder %}&select_folder=1{% endif %}{% endif %}" title="{% trans "Go back to" %} {% trans "root"|title %} {% trans "folder" %}"><i class="icon-arrow-up icon-alpha75"></i></a>{% endif %}
                <img src="{{ folder.icons.48 }}" alt="{% trans "Folder Icon" %}" /> {{ folder.name }}
                <span class="small quiet">({% blocktrans count folder.children_count as counter %}1 folder{% plural %}{{ counter }} folders{% endblocktrans %}, {% blocktrans count folder.file_count as counter %}1 file{% plural %}{{ counter }} files{% endblocktrans %})</span>
                <span>
                    {% if is_popup %}
                        {% if select_folder and folder.file_type == 'Folder' %}&nbsp;<a class="insertlink insertlinkButton btn btn-info btn-small" href="" onclick="opener.dismissRelatedFolderLookupPopup(window, {{ folder.id }}, '{{ folder.pretty_logical_path }}'); return false;"><i class="icon-ok-sign icon-white"></i></a>{% endif %}
                    {% else %}<a style="display: block; float: right;" class="changelink" href="{% url 'admin:filer_folder_change' folder.id %}" title="{% trans "Change current folder details" %}">{% trans "Change" %}</a>{% endif %}
                </span>
            </h2>
            {% else %}{% if folder.is_smart_folder %}
            <h2 class="folder_header"><a href="{% url 'admin:filer-directory_listing-root' %}{% if is_popup %}?_popup=1{% if select_folder %}&select_folder=1{% endif %}{% endif %}"><i class="icon-arrow-up icon-alpha75"></i></a>
                <img src="{{ folder.icons.32 }}" alt="{% trans "Folder Icon" %}" /> {{ folder.name }}
            </h2>
            {% endif %}
            {% endif %}

            <form id="changelist-form" action="" method="post" class="form-inline">{% csrf_token %}
            {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
            {% if action_form and actions_on_top and paginator.count and not select_folder and not is_popup %}{% filer_actions %}{% endif %}
            {% include "admin/filer/folder/directory_table.html" %}
            {% if action_form and actions_on_bottom and paginator.count and not select_folder and not is_popup %}{% filer_actions %}{% endif %}
            </form>
        </div>
    </div>
</div>

{% endblock %}
